package com.diver.flinkdemo.mapper.mysqlMapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.diver.flinkdemo.entity.xxt.School;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
//@Component
public interface SchoolMapper extends BaseMapper<School> {
    @Insert("insert into school(id,name,province,city,region,address,latitude,longitude,delete_flag,has_fence,create_time,wifi_info) " +
            "values(#{id},#{name},#{province},#{city},#{region},#{address},#{latitude},#{longitude},#{deleteFlag},#{hasFence},#{createTime},#{wifiInfo})")
    int add(School school);

    //根据学校名称模糊搜索
    @Select("select * from school where name like CONCAT('%', #{name}, '%') and delete_flag=0")
    List<School> queryByNameVague(@Param("name") String name);

    @Select("select name from school where delete_flag=0")
    List<String> aueryNames();
}
